/**********************************************************************************************************************
 *
 * Project:    mGameEngine
 * File:       drawable.h
 * Author:     karooolek
 * Created on: 2009-03-14
 *
 **********************************************************************************************************************/

#ifndef DRAWABLE_H_
#define DRAWABLE_H_

#include "../common.h"

namespace mGameEngine
{
namespace Graphics
{

/**
 * Interface for drawable elements.
 * Drawable element knows how to draw itself using different LODs
 * and stores it's simplified bounding volume (used for culling).
 */
class Drawable
{
protected:
    /**
     * Drawable element bounding sphere.
     */
    Sphere _boundingSphere;

    /**
     * Current level of detail
     */
    float _lod;

    /**
     * Current drawable visibility.
     */
    bool _visible;

public:
    /**
     * Create drawable object.
     */
    Drawable();

    /**
     * Destroy drawable object.
     */
    virtual ~Drawable();

    /**
     * Draw object.
     */
    virtual void draw() const = 0;

    /**
     * Set drawable element bouding sphere.
     * @param boundingSphere bounding sphere.
     */
    void setBoundingSphere(const Sphere &boundingSphere)
    {
        _boundingSphere = boundingSphere;
    }

    /**
     * Get drawable element bounding sphere.
     * @return drawable element bounding sphere.
     */
    const Sphere &getBoundingSphere() const
    {
        return _boundingSphere;
    }

    /**
     * Set drawable element current level of detail.
     * @param lod level of detail.
     */
    void setLevelOfDetail(float lod)
    {
        _lod = lod;
    }

    /**
     * Get drawable element current level of detail.
     * @return current level of detail.
     */
    float getLevelOfDetail() const
    {
        return _lod;
    }

    /**
     * Set drawable visibility.
     * @param visible drawable visibility.
     */
    void setVisible(bool visible)
    {
        _visible = visible;
    }

    /**
     * Check if drawable is visible.
     * @return true if drawable is visible, false otherwise.
     */
    bool isVisible() const
    {
        return _visible;
    }
};

}
}

#endif // DRAWABLE_H_
